@extends('web.layouts.app')

@section('styles')
    <link rel="stylesheet" type="text/css" href="{{ asset('resources/web/css/index.css') }}">
    <link rel="stylesheet" type="text/css" href="{{ asset('resources/web/css/ucenter.css')}}">
@endsection

@section('content')
    <div class="uc-wrap swrap mt20">
        <div class="uc-side L">
            <div class="uc-nav">
                <ul>
                    @include('web.user_center.menu')
                </ul>
            </div>
        </div>
      <div class="uc-main uc-mainbg R">
        <h3 class="uc-main-title">客户管理--{{$u->userInfo->name??''}}</h3>
        <!--查询表单-->
        <div class="user-custom-search ml20"><form method="get" action="{{ action('UserCenter\AgentController@customerInvestList',['id' => $user->id,'menu' =>8]) }}"">
				<span class="ml20">起止日期</span>
				<input type="text" name="startTime" value="{{ $query['startTime']}}" class="date-txt Wdate" onclick="WdatePicker();"> -
				<input type="text" name="endTime" value="{{ $query['endTime'] }}" class="date-txt Wdate" onclick="WdatePicker();">

				<select class="select2" style="height:25px;width:100px;" name="status">
					<option value="">全部</option>
					<option value="rush" {{ $query['status'] == 'rush'?'selected=selected':'' }}>正在投资</option>
					<option value="payment" {{ $query['status'] == 'payment'?'selected=selected':'' }}>正在还款</option>
					<option value="late" {{ $query['status'] == 'late'?'selected=selected':'' }}>还款逾期</option>
					<option value="full" {{ $query['status'] == 'full'?'selected=selected':'' }}>项目满标</option>
					<option value="finish" {{ $query['status'] == 'finish'?'selected=selected':'' }}>还款成功</option>
					<option value="fail" {{ $query['status'] == 'fail'?'selected=selected':'' }}>项目流标</option>
				</select>
				<input type="submit" class="btn" value="搜索">
			</form>
        </div>
        <!--列表-->
        <div class="user-item-list pt20">
				<h3 class="title">投资项目</h3>
				<ul class="data-list near-invest-list">
					<li class="th">
						<div class="col-name">项目名称</div>
						<div class="col-money">投资金额</div>
						<div class="col-gains">预期收益(仅供参考)</div>
						<div class="col-invest-time">投资时间</div>
						<div class="col-expire-time">还款时间</div>
						<div class="col-status">进度情况</div>
						<div class="col-ht">合同资料</div>
					</li>
				@forelse($data as $d)
					<li>
						<div class="col-name name">
							<a href="/oneProjects/{{$d->id}}">{{ $d->projects_name }}</a>
						</div>
						<div class="col-money">{{ $d->invest_money }}</div>
						<div class="col-gains">
						@if($d->id<309 && ($d->expected_return == 0))
							请以老网站为准
						@else
							{{ $d->expected_return }}
						@endif
						</div>
						<div class="col-invest-time">{{ $d->invest_time }}</div>
						<div class="col-expire-time">{{ ($d->trade_finish_date??$d->trade_repayment_date)??'--' }}</div>
						<div class="col-status"> {{ \App\Admin\Eloquent\Code::findByCodeAndTypeId($d->status, 'project_status')['name'] }}</div>
						<div class="col-ht">
						@if(empty($d->projects_file))
							<span>待生成</span>
						@else
							<a class="blue" href="{{ action('UserCenter\UserCenterController@printTemplate',[$d->id]) }}" target="_bank">打印</a>
						@endif
						</div>
						<div id='print' style="display: none;">
							这里是合同正文
						</div>
					</li>
				@empty
					<li>最近没有投资的项目</li>
				@endforelse
				</ul>
				<div class="uc-page-box text-right">
					{!! $links !!}
				</div>
			</div>

    </div>
</div>
@endsection

@section('scripts')
    <script src="{{ asset('resources/web/js/index.js') }}"></script>
	<script type="text/javascript" src="{{asset('resources/web/plugins/datePicker/WdatePicker.js')}}"></script>
@endsection